﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SecureTree
{
    public partial class SelectLocation : Form
    {
        public SelectLocation()
        {
            InitializeComponent();
        }
        public string xmlLocation;

        private void fileName_DoubleClick(object sender, EventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.Description = "请选择客户端更新文件夹";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (string.IsNullOrEmpty(dialog.SelectedPath))
                {
                    MessageBox.Show(this, "文件夹路径不能为空", "提示");
                    return;
                }

               fileName.Text = dialog.SelectedPath;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (fileName.Text.Contains('.'))
            {
                xmlLocation = fileName.Text.Split('.')[0] + ".xml";
                this.Close();
            }
            else
            {
                xmlLocation = fileName.Text.Split('.')[0] + "\\DevNet.xml";
                DialogResult = DialogResult.OK;
                this.Close();
            }
           
        }
    }
}
